package com.bys.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@RestController
public class PayController {
    @Resource
    public RestTemplate restTemplate;
    public static final String getUri = "edu-hystrix-provider";
    @GetMapping("/consumer/fusing")
    public String get_fusing(){
        String url = "http://" + getUri + "/pay/hystrix/fusing";
        return restTemplate.getForObject(url,String.class);
    }
    @GetMapping("/consumer/ok/{payId}")
    public String getOk(@PathVariable Integer payId){
        String url = "http://" + getUri + "/pay/hystrix/ok/"+ payId;
       return restTemplate.getForObject(url,String.class);
    }
}
